<?php

class UserController extends BackendController
{
    public $active = "personalconfig";

    public function actionIndex()
    {

        $actionType = isset($_REQUEST['actionType'])?$_REQUEST['actionType']:null;

        if($actionType == 'updatePassword'){
            $newpassword = $_REQUEST['newpassword'];
            $newpassword = md5($newpassword);
            $username = Yii::app()->user->getId();
            $this->connection->createCommand("update rk_user set password = :password where username = :username")
                ->bindParam(":password",$newpassword)
                ->bindParam(":username",$username)
                ->execute();
            $this->data['message'] = AppCode::$success;
        }

        $this->render("index", $this->data);
    }

}